<?php

namespace App\Http\Controllers\Home;

use App\Http\Controllers\Controller;
use App\Models\Erp;
use App\Models\Offer;
use App\Models\Deputy;
use App\Models\Product;
use App\Models\Seo;
use Illuminate\Http\Request;

class ProductController extends Controller {

    public function shop(Request $request){
        $seo = Seo::getSeo(2);
        //合作伙伴
        $partners = Deputy::where('status',Deputy::STATUS_1)->where('cid',23)->orderBy('id','asc')->get()->toArray();
        $partners = array_chunk($partners,25);
        return view('home.product.index',compact('seo','partners'));
    }


    public function dms(Request $request){
        $seo = Seo::getSeo(3);
        return view('home.product.dms',compact('seo'));
    }

    public function erp(Request $request){
        $seo = Seo::getSeo(4);
        $all = Erp::where('status',Erp::STATUS_1)->orderBy('id','asc')->get()->toArray();
        $ecologys = [];
        foreach ($all as $key => $ecology){
            $ecologys[$ecology['cid']][] = $ecology;
        }
        return view('home.product.erp',compact('seo','ecologys'));
    }

}
